package com.hnevc.chenqi;
/**
 * 注意输出指定空心正方形。输入第一个数字为边长，第二个字符为组成图形边的字符
 * 注意：使用嵌套循环实现。
 */

import java.util.Scanner;

public class Homework38 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入图形边长：");
        int n = sc.nextInt();
        System.out.println("请输入组成图形边的字符：");
        String b = sc.next();
        String str = "*";
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i == 0) {
                    System.out.print(b);
                } else if (i == n - 1) {
                    System.out.print(b);
                } else if (j == 0 || j == n - 1) {
                    System.out.print(b);
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}
